package itsm.isperp.module.service.incident;

import itsm.isperp.framework.data.domain.DataRequest;
import itsm.isperp.framework.service.BaseService;
import itsm.isperp.framework.web.request.JqGridFilterRuleOp;
import itsm.isperp.framework.web.request.JqGridRequest;
import itsm.isperp.module.entity.incident.IcdMajorHandle;
import itsm.isperp.module.repository.incident.IcdMajorHandleMapper;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.stereotype.Service;

/**
 * 服务
 * 
 * @author lizx
 * @date 2016-11-28 09:29
 */
@Service
public class IcdMajorHandleService extends BaseService<IcdMajorHandle> {

	@Autowired
	protected IcdMajorHandleMapper icdMajorHandleMapper;

	@Override
	public IcdMajorHandleMapper getRepository() {
		return this.icdMajorHandleMapper;
	}

	public List<IcdMajorHandle> findAllByIncidentId(String incidentId) {
		DataRequest req = new JqGridRequest();
		req.addFilterRule("incident_id", JqGridFilterRuleOp.eq, incidentId);
		req.setSort("handle_time", Direction.ASC);
		req.isPageable(false);

	 
		return this.getRepository().findAllByRequest(req);
	}

}
